<script>
  /*商品详细通用函数*/

  var priceControl={
    base:<{$goods.current_price}>,
    // _format:<{$money_format|default:'false'}>,
    _format:<{$money_format|default:'false'}>,/*decimals":2,"dec_point":".","thousands_sep":"","fonttend_decimal_type":0,"fonttend_decimal_remain":2,"sign":"\uffe5*/
    format:function(num){
      var part;
      if(!num && num !==0)return;
      var num = num.toFloat();
      if(this._format.cur_rate) {
        num = num * this._format.cur_rate;
      }
      num = num.round(this._format.decimals)+'';
      var p =num.indexOf('.');
      if(p<0){
        p = num.length;
        part = '';
        }else{
        part = num.substr(p+1);
      }
      while(part.length<this._format.decimals){
        part+='0';
      }
      var c=[];
      while(p>0){
        if(p>2){
          c.unshift(num.substr(p-=3,3));
          }else{
          c.unshift(num.substr(0,p));
          break;
        }
      }
      if(!part){
        this._format.dec_point='';
      }
      return (this._format.sign||"")+c.join(this._format.thousands_sep)+this._format.dec_point+part;
    }
  };

  String.implement({
    toFormElements:function(){
      if(!this.contains('=')&&!this.contains('&'))return new Element('input',{type:'hidden'});
      var elements=[];
      var queryStringHash=this.split('&');
      Array.from(queryStringHash).each(function(item){
        if(item.contains('=')){
          item=Array.from(item.split('='));
          elements.push(new Element('input',{type:'hidden',name:item[0],value:item[1]}));
          }else{
          elements.push(new Element('input',{type:'hidden',name:item}));
        }
      });
      return new Elements(elements);
    }
  });
  Number.implement({
    interzone:function(min,max){
      var _v=this.toFloat();
      if(!_v)_v=0;
      return _v>=min&&_v<=max;
    }
  });
  var keyCodeFix=[48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105,8,9,46,37,39<{if $goods.type.floatstore}>,110,190<{/if}>];


</script>

<div class="goods-info-wrap clearfix" id="goods-viewer">
    <!--暂时针对于团购 开放立即购买功能时需修改-->
    <form action="<{link app=b2c ctl=site_cart act=addToCart}>" class="fastbuy-form" id="fastbuy-form" method="POST">
    </form>
    <h2 class="goodsname" id="h5o-2"><{$goods.name|escape:"html"}></h2>
    <div id="main-info">
      <form class="goods-action" action="<{link app=b2c ctl='site_cart' act='addToCart' arg0='goods'}>" gnotify="<{link app=b2c ctl=site_product act=gnotify}>" method="post" <{if $goods.setting.buytarget==2}> target="_blank_cart"<{elseif $goods.setting.buytarget==3}> target="_dialog_minicart"<{/if}>>
        <div class="goods-leftbox"><{include file="site/product/goodspics.html" app=b2c}></div>
        <div class="goods-rightbox">
          <!--商品基本信息区块-->
          <div class='basic-inf list clearfix'> <{foreach from=$info_page_list item=item}>
            <{include file=$item.file app=$item.app }>
            <{/foreach}>
          </div>
          <!--商品基本信息区块结束-->

          <!--商品评分-->
           <{if $comment.switch.discuss == 'on'}>
          <div class="star-div goods-point clearfix"><span class="flt font-black"><{t}>商品评分：<{/t}></span>
            <ul>
              <li class="star<{$goods_point.avg}>"></li>
            </ul>
          </div>
          <{/if}>
          <!--商品评分区块结束-->

          <!--商品简介区块-->
          <{if $goods.brief}>
          <p class="goods-brief ">
          <span ><{t}>商品简介：<{/t}></span>
          <em><{$goods.brief}></em>
          </p>
          <{/if}>
          <!--商品简介区块结束-->

          <!------------------------------------ 购买区域 开始 -------------------------------->
          <{assign var=tmp value=$goods.product}>
          <{assign var=product0bn value=$tmp|array_shift}>

          <{if count($promotions)>0}>
          <ul class="boxBlue list">
            <{foreach from=$promotions item=promotion key=key}>
            <li>
              <strong class="font-red"><{$promotion.pmt_describe}></strong>
              <span class="font11px font-black"><{$promotion.pmt_time_begin|userdate}> ~ <{$promotion.pmt_time_end|userdate}></span>
            </li>
            <{/foreach}>
          </ul>
          <{/if}>

          <{if !$login&&$mLevel  && $env.conf.b2c.site.member_price_display != 2}>
          <div class='mprice' ><{if $goods_point.avg}>
            <!--商品评分区块-->
            <{/if}>
            <h4 class="member-price"><{t}>会员价:<{/t}></h4>
            <ul>
              <{assign var=aProduct value=$goods[product]|current}>
              <{if $env.conf.b2c.site.member_price_display == 1}>
              <{foreach from=$aProduct.price.member_lv_price item=lItem name=mlv}>
              <li>
                <span class="font-black"><{$lItem.title}>:</span>
                <em class='mlvprice font-red fontbold lv-<{$lItem.level_id}>' mlv='<{$lItem.level_id}>'><{$lItem.price|cur_odr}></em>
              </li>
              <{/foreach}>
              <{elseif $env.conf.b2c.site.member_price_display == 0}>
              <{assign var=aProductPrice value=$aProduct[price][member_lv_price]}>
              <li>
                <span class="font-black"><{$aProductPrice[$this_member_lv_id][title]}>:</span>
                <em class='fontbold mlvprice font-red lv-<{$aProductPrice[$this_member_lv_id][level_id]}>' mlv='<{$aProductPrice[$this_member_lv_id][level_id]}>'><{$aProductPrice[$this_member_lv_id][price]|cur_odr}></em>
              </li>
              <{/if}>
            </ul>
          </div>
          <{/if}>
          <{if $promotionMsg||$promotionOrder}>
          <div class="sale-info clearfix">
            <p class="w100 fontbold flt">可享受的促销：</p>
            <div class="span-auto type">
              <p><{$promotionMsg}></p>
              <p><{$promotionOrder}></p>
            </div>
          </div>
          <{/if}>
          <{if $goods.status == 'false' }>
          <!---已下架--->
          <{foreach from=$specAddHtml item=item}>
            <{$item}>
          <{/foreach}>
          <div class="hight-offline">
            <div class="hightbox">
              <div class="btnBar clearfix">
                <div class="flt" style="font-weight:bold;padding:5px;"><{t}>此商品已下架<{/t}></div>
                <div class="floatRight">
                  <ul class="button">
                    <li  class="star-on" <{if $login!="nologin"}>star="<{$goods.goods_id}>"<{/if}> title="<{$goods.name|escape:html}>">
                    <a <{if $login=="nologin"}>href="<{link app="b2c" ctl="site_passport" act="login"}>" <{else}>href="###" rel="_fav_"<{/if}> class="btn-a listact">
                      <i class="has-icon"> <!-- <img src='<{$env.app.res_url}>/bundle/collect_icon.gif' />--></i>
                      <span >
                        <div class="fav"><{t}>收藏此商品<{/t}></div>
                        <div class="nofav"><{t}>已收藏<{/t}></div>
                      </span>
                    </a>
                    </li>
                    <!-- <li><a href="#" class="btn-send"><{t}>发送给好友<{/t}></a></li> -->
                  </ul>
                </div>
              </div>
            </div>
          </div>
          <{else}>
          <!---规格开始--->
          <{if $goods.spec }>
          <{include file='site/product/spec.html' app=b2c}>
          <{/if}>
          <!---规格结束--->
          <{foreach from=$specAddHtml item=item}>
            <{$item}>
          <{/foreach}>
          <!--购买数量-->
          <div class='buyinfo clearfix'>
            <label><{t}>数量：<{/t}></label>
            <div class="Numinput">
              <input type="text" numtype="<{if $goods.type.floatstore === '1'}>float<{else}>int<{/if}>" name="goods[num]" size="5" value=1 />
              <div class="numadjust-arr">
                <span class="numadjust increase"></span>
                <span class="numadjust decrease"></span>
              </div>
            </div>
            <span><{if $goods.package_unit}><{$goods.package_unit}><{t}>(每<{/t}><{$goods.package_scale}><{t}>个一<{/t}><{$goods.package_unit}>)<{/if}></span>
            <span updatespec="text_store"  <{if $showStorage != 'true'}>style='display:none;'<{/if}>><{t}>( 库存&nbsp;<{/t}><em class='store font-red'><{if $goods.store >= 9999 || $goods.store === null || $goods.store === '' || $goods.nostore_sell}>9999+<{elseif $goods.store - $goods.product_freez > 0}><{$goods.upstore - $goods.product_freez}><{else}>0<{/if}></em> )</span>

          </div>
          <!--购买数量结束-->
          <!--购买按钮-->
          <div class="hightline">
            <input type="hidden" name="goods[goods_id]" value="<{$goods.goods_id}>" />
            <input type="hidden" name="goods[pmt_id]" value="<{$goods.pmt_id}>" />
            <{if !$goods.spec }>
            <input type='hidden' name='goods[product_id]' value='<{$product0id}>'/>
            <{/if}>
            <div class="btnBar clearfix" <{if count($goods.product)<0}>style="visibility:hidden"<{/if}>>
              <div class="flt btnwrap">
                <!--页面按钮service形式 start -->
                <{foreach from=$btn_page_list item=item}>
                <{include file=$item.file app=$item.app }>
                <{/foreach}>
                <!--页面按钮service形式 end -->
              </div>
              <div class="flt btnwrap addcollect">
                <ul class="button">
                  <li  class="star-off" <{if $login!="nologin"}>star="<{$goods.goods_id}>"<{/if}> title="<{$goods.name|escape:html}>"> <a <{if $login=="nologin"}>href="<{link app="b2c" ctl="site_passport" act="login"}>" <{else}>href="###" rel="_fav_"<{/if}> class="btn-a listact"><i class="has-icon"> <!-- <img src='<{$env.app.res_url}>/bundle/collect_icon.gif' /> --></i><span>
                      <div class="fav"><{t}>收藏此商品<{/t}></div>
                      <div class="nofav"><{t}>已收藏<{/t}></div>
                  </span></a>
                  </li>
                </ul>
              </div>
            </div>
          </div>
          <!--购买按钮结束-->
          <!--分享开始-->
          <div class="share" style="display:none;"></div>
          <!--分享结束-->
        <{/if}>
        </div>
        <!------------------------------------ 配件 开始 -------------------------------->
        <{if $goods.adjunct && count($goods.adjunct)>0}>
        <{include file='site/product/adjunct.html' app=b2c}>
        <{/if}>
      </div>
    </form>
    <!-- </td>
</tr>
  </table>-->
  <!--货品列表-->
  <{if $goods.spec}>
  <{include file='site/product/products.html' app=b2c}>
  <{/if}>
  <div style="clear:both"></div>
  <!------------------------------------ 购买区域 结束 -------------------------------->
  <!--页面body page start -->
  <{if $body_page_list}>
  <!--  <div class="goods-detail-tab clearfix" > </div> -->
  <{foreach from=$body_page_list item=item}>
  <{include file=$item.file app=$item.app }>
  <{/foreach}>
  <{/if}>
  <!--页面body page end -->
</div>
<{include file='site/product/goods_js.html' app=b2c}>
